-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[typescript] fixture: broken Array<Array>
#19548
[typescript] fixture: broken Array<Array>
#19548
Conversation
import { HttpFile } from '../http/http'; | ||
|
||
export class ListPaged { | ||
'data'?: Array<Array>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be:
'data'?: Array<Array>; | |
'data'?: Array<List>; |
the issue occurs because of a type mapping Line 114 in 0026e15
this happens with any model named like a native type. the typemapping can be overridden by parameter, so i would suggest to close this PR |
I was wondering if that was the case, but couldn't find it. Thanks for the code pointer.
When you say "native type" you mean a native Java type that symbol in swagger matches to? Given that:
my thoughts are that we should probably fix this in the generator? WDYT? |
I dont know why the |
I guess this could be a leftover, IIRC there was such a List mapping in Lines 331 to 358 in fd85359
|
Great! Yes, give me an hour or so and I'll put it up! |
@macjohnny changes are in, PTAL. |
Thank you for 🚤 @macjohnny! |
@joscha thanks for your contribution! |
Full disclosure: I haven't been able to fix this issue, yet. I can reproduce it and I created a fixture that shows the problem, but I need some help figuring out where exactly the issue occurs.
This introduces a fixture that shows an issue with the typescript generator.
Currently, for a definition like this (reduced for brevity, see
array_list.yaml
for full version):(an array of objects with the name
List
).as Typescript type like:
is produced. This is both incorrect as well as syntactically invalid (missing generic for the inner
Array
type).It should be:
Interestingly, if the name of
List
is changed to something that is not close to a reserved word, likeL
for example, it generates correctly. E.g.:Thus I am assuming there is somewhere in the model generation code where the word
List
is interpreted as being an array type.Running the fixture with
typescript-fetch
shows that theListPaged
type gets generated correctly for this generator.PR checklist
master
(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)